/*
 *  Events.h
 *  SypXIPhone
 *
 *  Created by Luv Khemani on 5/18/10.
 *  Copyright 2010 Luv Khemani. All rights reserved.
 *
 */

#pragma once
#ifndef SYPX_EVENTS
#define SYPX_EVENTS

#include "Base.h"
#include "Types.h"

namespace SypX 
{
	///EventType enums
	enum EventType 
	{
		NOEVENTS,	//No new events in the que to be processed
		MOUSELEFTDOWN,
		MOUSELEFTUP,
		MOUSERIGHTDOWN,
		MOUSERIGHTUP,
		MOUSEMOVE,
		TOUCHDOWN,	//touch based devices
		TOUCHUP,
		TOUCHMOVE,
		KEYPRESS,
		/*
		UIDeviceOrientationUnknown
		The orientation of the device cannot be determined.
		
		UIDeviceOrientationPortrait
		The device is in portrait mode, with the device held upright and the home button at the bottom.
		
		UIDeviceOrientationPortraitUpsideDown
		The device is in portrait mode but upside down, with the device held upright and the home button at the top.
		
		UIDeviceOrientationLandscapeLeft
		The device is in landscape mode, with the device held upright and the home button on the right side.
		
		UIDeviceOrientationLandscapeRight
		The device is in landscape mode, with the device held upright and the home button on the left side.
		
		UIDeviceOrientationFaceUp
		The device is held parallel to the ground with the screen facing upwards.
		
		UIDeviceOrientationFaceDown
		The device is held parallel to the ground with the screen facing downwards.
		*/
		DeviceOrientationUnknown,
		DeviceOrientationPortrait,
		DeviceOrientationPortraitUpsideDown,
		DeviceOrientationLandscapeLeft,
		DeviceOrientationLandscapeRight,
		DeviceOrientationFaceUp,
		DeviceOrientationFaceDown,

	};	
	
	///Event structure which holds information of Event data
	struct SYPXAPI Event
	{
		///A point2 structure, usually to define coordinates for mouse/touch events
		struct Point2D {
			UInt x;
			UInt y;
		};
		
		///Contains 2 points defining drag information
		struct DragData
		{
			Point2D prev;
			Point2D curr;
		};
		///Describes the EventType		
		EventType type;
		///union to conserve memory since only 1 of the fields is relevant to the event type
		union 
		{
			Point2D location;	//Used for clicked position/coordinates			
			DragData moved;		//Stores drag information, prev point and current point after dragging						
		};
		
	};
	
}

#endif